#include "label.h"
#include <QDebug>
#include <QMouseEvent>
Label::Label(QWidget* parent) : QLabel(parent)
{

}

void Label::mousePressEvent(QMouseEvent *event)
{
    if(event->button() == Qt::LeftButton)
    {
        qDebug() <<"按下左键";
    }
    //当前event对象就包含了鼠标点击位置的坐标
    qDebug() << event->x()<<" "<<event->y();
    //globalX是以屏幕左上角为原点，或许得坐标
    qDebug() << event->globalX()<<" "<<event->globalY();
}

void Label::mouseReleaseEvent(QMouseEvent *event)
{
    if(event->button() == Qt::LeftButton)
    {
        qDebug() <<"释放左键";
    }
}

void Label::mouseDoubleClickEvent(QMouseEvent *event)
{
    if(event->button() == Qt::LeftButton)
    {
        qDebug() <<"左键双击";
    }
}

void Label::mouseMoveEvent(QMouseEvent *event)
{

}
